package com.itany.template;

import java.util.Arrays;

/**
 * Author:石小俊
 * Date: 2022/11/3 15:02
 */
public class Test {

    public static void main(String[] args) {
//        String[] arr = {"a","admin","jack","abc"};
//        StringSortUtil util = new StringSortUtil();
//        util.sort(arr);
//        System.out.println(Arrays.toString(arr));

        String[] arr = {"a","admin","jack","abc"};
        SortTemplate.sort(arr, new SortComparator<String>() {
            @Override
            public int compareTo(String t1, String t2) {
                return -t1.length() + t2.length();
            }
        });
        System.out.println(Arrays.toString(arr));

        Integer[] arr2 = {1,3,8,6,5};
        SortTemplate.sort(arr2, new SortComparator<Integer>() {
            @Override
            public int compareTo(Integer t1, Integer t2) {
                return t2-t1;
            }
        });
        System.out.println(Arrays.toString(arr2));
    }

}
